<template>
	<view>
		<view class="cu-form-group margin-top">
			<view class="title">发帖是否审核</view>
			<switch @change="SwitchA" :class="switchA ? 'checked':''" :checked="check?true:false"></switch>
		</view>
		<view class="margin-top-sm"></view>
		<text class="text-grey margin-top margin-left-sm">Tips:控制发帖审核还是不审核(选中为要审核)</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				check:false
			}
		},
		async onShow(){
			this.init()
		},
		methods: {
			async SwitchA(e) {
				uni.showLoading({
					title:"修改中"
				})
				await this.$store.dispatch('changecheck', e.detail.value)
				uni.showToast({
					title: "修改成功"
				})
			},
			async onPullDownRefresh(){
				this.init()
			},
			async init(){
				uni.showLoading()
				await this.$store.dispatch('initcheck') 
				this.check =  this.$store.state.audit
				uni.stopPullDownRefresh()
				uni.hideLoading()
			}
		}
	}
</script>

<style>

</style>
